<?php

class Application_Model_OrderDetail
{
    /**
     * @param int $orderID
     * @param int $productID
     * @param int $amount
     * @param int $totalCost
     * @return int
     */
    public static function addOrderDetail($orderID, $productID, $amount, $totalCost)
    {
        $dbAdapter = JDbAdapter::factory();

        try {
            $dbAdapter->insert(
                'ORDER_DETAILS',
                array(
                    'OrderID' => $orderID,
                    'ProductID' => $productID,
                    'Amount' => $amount,
                    'TotalCost' => $totalCost
                )
            );

            return true;
        } catch (Exception $ex) {
            JLog::log($ex->getMessage());
            return false;
        }
    }
}
